<template>
  <div>
    <h3>Test组件</h3>
    <p ref="abc">这是Test组件中的p标签</p>
    <button @click="getP">获取p</button>
  </div>
</template>

<script>
export default {
  methods: {
    getP() {
      const p = this.$refs.abc; //根据ref值,查找元素的写法
      console.log(p.innerHTML);
    },
  },
};
</script>

<style>
</style>